package com.mapper;

import com.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * Created by Yuicon on 2017/3/19.
 */
@Repository
public interface UserMapper {

    @Select("select * from tb_user where id = #{id}")
    User findById(String id);

    @Select("select * from tb_user where phone = #{phone}")
    User findByPhone(String phone);

    @Insert("insert into tb_user (id,nickName,passWord,phone,type,birthday,address,sex,individualitySignature,email) " +
            "values(#{id},#{nickName},#{passWord},#{phone},#{type},#{birthday},#{address},#{sex}," +
            "#{individualitySignature},#{email})")
    int insert(User user);

    @Update("update tb_user set passWord = #{passWord} where id = #{id}")
    int update(User user);

}
